<?
$this->placeholder('page_title')->set('Ultimatum: Order Types');

$grid_options = array();

$filename = dirname(__FILE__) . '/ordertypes_grid.ini';
$col = new Zend_Config_Ini($filename, 'columns');
$this->columns = $col->toArray();

$this->dojo()->requireModule('dijit.form.Button');

$this->headScript()->captureStart();
?>
function ordertypes_grid_edit_formatter(p)
{
    return '<a href="<?= $this->baseUrl() ?>/admin/ultimatum/ordertypeedit/id/'
        + p + '"><img src="<?= $this->baseUrl() ?>/images/icons/edit.gif" height="20" width="20" border="0"/></a>';
}

function ordertype_percent_formatter(p)
{
    return 10* p + '%';
}

var selected_indexes = {};
var grid;

function render_selection()
{
    var v = '';
    for (p in selected_indexes)
    {
        v += selected_indexes[p].id + ",";
    }

    dojo.byId('selected_ordertypes').value = v;
}

function ordertypes_grid_active_get(id, record)
{
    if ((!record)) return '';
    if (record.active > 0) return '<a href="/admin/ultimatum/ordertypedeactivate/name/' + record.name  + '"><img src="/images/icons/okb.gif" height="20" width="20" border="0" /></a>';
    return '<a href="/admin/ultimatum/ordertypeactivate/name/' + record.name  + '"><img src="/images/icons/xb.gif" height="20" width="20" border="0" /></a>';
}


<?  $this->headScript()->captureEnd();   ?>

<?= $this->dojostore('ordertypes_store', $this->baseUrl() . '/admin/ultimatum/ordertypestore') ?>
<?= $this->dojogrid('ordertype_grid', 'ordertypes_store', $this->columns, 'name', NULL, $grid_options) ?>

<a href="<?= $this->baseUrl() ?>/admin/ultimatum/ordertypenew" class="linkbutton">Add Order Type</a>
<br />
